import { GameObject } from "./GameObject";

export class GamePiece extends GameObject{
    constructor(info,gamemap){
        super();
        this.id = info.id;
        this.c = info.c; //当前玩家的落子位置
        this.r = info.r;
        this.color = info.color;
        this.gamemap = gamemap;
    }

    start(){

    }
    update(){
        this.render();
    }
    render(){
        const L = this.gamemap.L;
        const ctx = this.gamemap.ctx;
        const x = this.c *L;
        const y = this.r *L;

        ctx.beginPath();
        ctx.arc(x, y, L*0.45, 0, Math.PI * 2);
        
        ctx.fillStyle = this.color;
        
        ctx.fill();
    }
}